package com.itheima.demo;

import javax.sound.midi.Soundbank;
import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

public class Dmo5 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("zhangsan,18");
        list.add("wangwu,21");
        list.add("lisi ,19");

        Map<String, Integer> map = list.stream().collect(Collectors.toMap((String s) -> {
                    String[] split = s.split(",");
                    String key = split[0];
                    return key;
                },
                (String s) -> {
                    String[] split = s.split(",");
                    String value = split[1];
                    return Integer.valueOf(value);
                }));

    }
}
